package com.ruoyi.teacher.service.impl;

import java.util.*;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.teacher.domain.*;
import com.ruoyi.teacher.domain.vo.DataVO;
import com.ruoyi.teacher.domain.vo.QueryParamsVO;
import com.ruoyi.teacher.domain.vo.QueryVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.teacher.mapper.TeacherMapper;
import com.ruoyi.teacher.service.ITeacherService;

/**
 * 教师基本信息Service业务层处理
 *
 * @author Mie
 * @date 2022-04-12
 */
@Service
public class TeacherServiceImpl implements ITeacherService
{
    @Autowired(required = false)
    private TeacherMapper teacherMapper;

    /**
     * 自定义查询
     *
     * @param query 自定义查询条件
     * @return 自定义查询结果
     */
    @Override
    public List<QueryVO> selectQueryResult(QueryParamsVO query) {
        return teacherMapper.selectQueryResult(query);
    }
    /**
     * 自定义查询导出
     *
     * @param query 自定义查询条件
     * @return 自定义查询结果
     */
    @Override
    public List<QueryVO> selectQueryList(QueryVO query) {
        return teacherMapper.selectQueryList(query);
    }

    @Override
    public List<QueryVO> selectListByA00s(Long[] A00s) {
        return this.teacherMapper.selectListByA00s(A00s);
    }

    /**
     * 查询教师基本信息
     *
     * @param a00 教师基本信息ID
     * @return 教师基本信息
     */
    @Override
    public Teacher selectTeacherById(Long a00)
    {
        return teacherMapper.selectTeacherById(a00);
    }

    /**
     * 查询教师基本信息
     *
     * @param userId 用户ID
     * @return 教师基本信息
     */
    @Override
    public Teacher selectTeacherByUserId(Long userId)
    {
        return teacherMapper.selectTeacherByUserId(userId);
    }

    /**
     * 查询教师基本信息
     *
     * @param A00 用户ID
     * @return 教师基本信息
     */
    @Override
    public Teacher selectTeacherByA00(Long A00)
    {
        return teacherMapper.selectTeacherByA00(A00);
    }

    /**
     * 查询教师基本信息列表
     *
     * @param teacher 教师基本信息
     * @return 教师基本信息
     */
    @Override
    public List<Teacher> selectTeacherList(Teacher teacher)
    {
        return teacherMapper.selectTeacherList(teacher);
    }

    /**
     * 查询教师基本信息列表
     *
     * @param deptIds 指定部门id
     * @return 教师基本信息
     */
    @Override
    public List<Teacher> listTeacherByDeptIds(Long[] deptIds)
    {
        return teacherMapper.listTeacherByDeptIds(deptIds);
    }

    @Override
    public List<Teacher> selectListNoParamaters() {
        return teacherMapper.selectListNoParamaters();
    }

    @Override
    public List<Integer> selectTitleCount() {
        List<Integer> numbers = new ArrayList<>();
        Integer titleLevel = teacherMapper.selectTitleLevel();
        Integer titleLevel1 = teacherMapper.selectTitleLevel1();
        Integer titleLevel2 = teacherMapper.selectTitleLevel2();
        Integer titleLevel3 = teacherMapper.selectTitleLevel3();

        numbers.add(titleLevel);
        numbers.add(titleLevel1);
        numbers.add(titleLevel2);
        numbers.add(titleLevel3);
        return numbers;
    }

    /**
     * 查询教师各年龄段的人数
     * @return 教师各年龄段的人数
     */
    @Override
    public List<Integer> selectCount() {

        List<Integer> numbers = new ArrayList<>();
        Integer number1 = teacherMapper.selectCount1();
        Integer number2 = teacherMapper.selectCount2();
        Integer number3 = teacherMapper.selectCount3();
        Integer number4 = teacherMapper.selectCount4();
        Integer number5 = teacherMapper.selectCount5();
        Integer number6 = teacherMapper.selectCount6();
        Integer number7 = teacherMapper.selectCount7();

        numbers.add(number1);
        numbers.add(number2);
        numbers.add(number3);
        numbers.add(number4);
        numbers.add(number5);
        numbers.add(number6);
        numbers.add(number7);
        return numbers;
    }

    @Override
    public List<DataVO> selectDegreeCount() {
        List<DataVO> degrees = new ArrayList<>();
        DataVO degree = teacherMapper.selectDegree();
        DataVO degree1 = teacherMapper.selectDegree1();
        DataVO degree2 = teacherMapper.selectDegree2();
        DataVO degree3 = teacherMapper.selectDegree3();
        degrees.add(degree);
        degrees.add(degree1);
        degrees.add(degree2);
        degrees.add(degree3);
        return degrees;
    }

    /**
     * 通过A00查询教师的学历学位信息
     *
     * @param A00 指定教师ID
     * @return 教师的学历学位信息
     */
    @Override
    public List<Degree> selectDegreeByA00(Long A00)
    {
        return teacherMapper.selectDegreeByA00(A00);
    }

    /**
     * 通过A00查询教师的工作信息
     *
     * @param A00 指定教师ID
     * @return 教师的工作信息
     */
    @Override
    public List<TWork> selectWorkInfoByA00(Long A00)
    {
        return teacherMapper.selectWorkInfoByA00(A00);
    }


    /**
     * 通过A00查询教师的职称信息
     *
     * @param A00 指定教师ID
     * @return 教师的职称信息
     */
    @Override
    public List<TTitle> selectTitleByA00(Long A00)
    {
        return teacherMapper.selectTitleByA00(A00);
    }

    /**
     * 通过A00查询教师的培训情况
     *
     * @param A00 指定教师ID
     * @return 教师的培训情况
     */
    @Override
    public List<TTrain> selectTrainByA00(Long A00)
    {
        return teacherMapper.selectTrainByA00(A00);
    }

    /**
     * 通过A00查询教师的考核信息
     *
     * @param A00 指定教师ID
     * @return 教师的考核信息
     */
    @Override
    public List<TAssessment> selectAssessmentByA00(Long A00)
    {
        return teacherMapper.selectAssessmentByA00(A00);
    }

    /**
     * 通过A00查询教师的档案信息
     *
     * @param A00 指定教师ID
     * @return 教师的档案信息
     */
    @Override
    public List<TFile> selectFileByA00(Long A00) {
        return teacherMapper.selectFileByA00(A00);
    }

    /**
     * 通过A00查询教师的附件材料
     *
     * @param A00 指定教师ID
     * @return 教师的附件材料
     */
    @Override
    public List<TAppendix> selectAppendixByA00(Long A00) {
        return teacherMapper.selectAppendixByA00(A00);
    }

    @Override
    public List<Teacher> selectListByA00(Long A00) {
        return this.teacherMapper.selectListByA00(A00);
    }

    /**
     * 新增教师基本信息
     *
     * @param teacher 教师基本信息
     * @return 结果
     */
    @Override
    public int insertTeacher(Teacher teacher)
    {
        teacher.setCreateTime(DateUtils.getNowDate());
        return teacherMapper.insertTeacher(teacher);
    }

    /**
     * 修改教师基本信息
     *
     * @param teacher 教师基本信息
     * @return 结果
     */
    @Override
    public int updateTeacher(Teacher teacher)
    {
        teacher.setUpdateTime(DateUtils.getNowDate());
        return teacherMapper.updateTeacher(teacher);
    }

    /**
     * 批量删除教师基本信息
     *
     * @param a00s 需要删除的教师基本信息ID
     * @return 结果
     */
    @Override
    public int deleteTeacherByIds(Long[] a00s)
    {
        return teacherMapper.deleteTeacherByIds(a00s);
    }

    /**
     * 删除教师基本信息信息
     *
     * @param a00 教师基本信息ID
     * @return 结果
     */
    @Override
    public int deleteTeacherById(Long a00)
    {
        return teacherMapper.deleteTeacherById(a00);
    }
}
